package thread;

public class SyncDemo3 {
    public static void main(String[] args) {
        Thread t1 = new Thread(){
            public void run(){
                Boo.doSome();
            }
        };
        Thread t2 = new Thread(){
            public void run(){
                Boo.doSome();
            }
        };
        t1.start();
        t2.start();

    }
}
class Boo {
    public synchronized static void doSome() {
        Thread t = Thread.currentThread();
        try {
            System.out.println(t.currentThread()+"运行了");
            t.sleep(5000);
            System.out.println(t.currentThread()+"结束了");
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}